#include "string.h"
#include <arpa/inet.h>
#include <ctime>
#include <iostream>
#include <netinet/in.h>
#include <stdio.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <xict_common/log/log.h>

class UDPClient {
public:
    UDPClient();
    ~UDPClient();

    void Init();
    void SetClientAddr(const char* ip, int port);
    void SetServerAddr(const char* ip, int port);
    void sendData(std::string msg);
    char* ReceiveData();

private:
    int serverSocket;
    int clientSocket;
    struct sockaddr_in server_addr;
    struct sockaddr_in client_addr;   // 创建客户端sockaddr_in结构体
    char send_info_buf[100], recv_info_buf[100];
    socklen_t len;
};
